package com.nbsaas.boot.store.rest.convert;

import com.nbsaas.boot.store.data.entity.StoreStaff;
import com.nbsaas.boot.store.api.domain.response.StoreStaffResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 实体对象转化成响应对象
*/

public class StoreStaffResponseConvert  implements Converter<StoreStaffResponse,StoreStaff> {

    @Override
    public StoreStaffResponse convert(StoreStaff source) {
        StoreStaffResponse  result = new  StoreStaffResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getStaff()!=null){
                        result.setStaffName(source.getStaff().getName());
                    }
                    if(source.getStore()!=null){
                        result.setStoreName(source.getStore().getName());
                    }
                    if(source.getStaff()!=null){
                        result.setStaff(source.getStaff().getId());
                    }
                    if(source.getStore()!=null){
                        result.setStore(source.getStore().getId());
                    }
        return result;
    }

}

